#include <iostream>

using namespace std;

int fib(int n) {
    if(n == 0 || n == 1) return n;
    int pre2 = 0;
    int pre1 = 1;
    int now;
    for(int i=2;i<=n;i++){
        now = pre1 + pre2;
        pre2 = pre1;
        pre1 = now;
    }
    return now;
}